<?php
    include ('functions.php');
    session_start();
    $array1 = selectAll();
    $_SESSION["purchases"] = $_COOKIE["boughttotal"];
    ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>THE SHOP :: main</title><link rel="stylesheet" type="text/css" href="style.css"/></head><META HTTP-EQUIV="Pragma" CONTENT="no-cache">

<META HTTP-EQUIV="Expires" CONTENT="-1"><body>
<div id="logo"><a href="index.php"><img src="img/logo.PNG" alt="THE SHOP"/></a></div>
<div id="main">

 <table width="100%" cellspacing="0" cellpadding="0">
    <tr><td id="mainpart"> <div id="menutable">
    <table width="95%" border="0">
      <tr>
        <td><p id="menu"><span id="selected"><a href="index.php">Main page</a></span> :: <a href="products.php">Product list</a> :: <a href="faq.php">FAQ</a> :: <a href="info.php">About</a> :: <a href="cart.php">Shopping cart</a></p></td>
        <td><form action="search.php" method="post" id="searchfield">
          <input name="search" type="text" value="Search now!" size="20" maxlength="100" onClick="this.value=''" />
          <input name="submit" type="submit" value="Search" />
        </form></td>
      </tr>
    </table>
  </div>
        <!-- MAIN PART -->
        <? 
        if(isset($_POST[search])) {
          echo "Search results for <b>";
          echo $_POST[search];
          echo "</b>:";
        } ?>

        <?php
            $sqlconnect=mysql_connect('localhost', 'root', 'kissakala');
            $dbselect=mysql_select_db('theshop', $sqlconnect);
            $sqlquery="SELECT * FROM products WHERE prodName LIKE '%$_POST[search]%' OR prodNo LIKE '%$_POST[search]%' OR prodDesc LIKE '%$_POST[search]%' OR prodShortDesc LIKE '%$_POST[search]%'";
            $sqlresult=mysql_query($sqlquery, $sqlconnect);
            while($sqlRow=mysql_fetch_array($sqlresult, MYSQL_ASSOC))
            {
                $id=$sqlRow['prodNo'];
                $pic=$sqlRow['prodPic'];
                $name=$sqlRow['prodName'];
                $desc=$sqlRow['prodDesc'];
                $value=$sqlRow['prodValue'];
                $amount=$sqlRow['prodAmount'];
                $ship=$sqlRow['prodShip'];
                $descshort=$sqlRow['prodShortDesc'];
                showItem($array1, $id, "img/icons/buy.PNG", "img/icons/buy_hover.PNG", 2);
            }
            mysql_close($sqlconnect);
        ?>
                                </td></tr>
                    </table>
        <!-- END OF MAIN PART -->
        </td>
    </tr>
  </table>
        <? putFooter();?>
</div>

</body>
</html>




